package com.ms.controller;

import com.ms.common.Result;
import com.ms.pojo.Leave_apply;
import com.ms.service.UserLeaveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userLeave")
@Tag(name = "员工请假接口")
public class UserLeaveController {
    @Autowired
    private UserLeaveService userLeaveService;
    @PostMapping("/insertLeaveApply")
    @Operation(summary = "员工申请假期信息接口")
    public Result<String> insertLeaveApply(@Valid @RequestBody Leave_apply leave_apply) {
        int result = userLeaveService.insertLeaveApply(leave_apply);
        if (result > 0) {
            return Result.success("请假申请提交成功");
        } else {
            return Result.error("请假申请提交失败");
        }
    }
}
